package com.ecas.code.generator.util;

import com.google.common.base.CaseFormat;

public class CamelCaseUtil {

    private CamelCaseUtil() {
    }

    public static String tableNameToClassName(String tableName){
        String[] nameArray =  tableName.split("_");
        String sufFix = nameArray.length > 1 ? nameArray[1]:nameArray[0];

     return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL,sufFix);
    }

    public static String columnNameToPropertyName(String columnName){
        return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL,columnName);
    }

    public static String columnNameToMethodName(String columnName){
        return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL,columnName);
    }
}
